package leetcode.hot100;

import java.util.ArrayList;
import java.util.List;

public class number763 {
    public static void main(String[] args) {
        System.out.println(partitionLabels("ababcbacadefegdehijhklij"));
    }

    public static List<Integer> partitionLabels(String s) {
        List<Integer>list=new ArrayList<>();
        for(int i=0;i<s.length();){
            char c=s.charAt(i);
            int lastIndex=s.lastIndexOf(c);
            list.add(lastIndex-i+1);
            i=lastIndex+1;
        }
        return list;
    }
}
